package com.hulizuofang.wol.chat.client.ui.event.changeplace;

import com.google.gwt.event.shared.GwtEvent;
import com.google.gwt.event.shared.HasHandlers;
import com.gwtplatform.mvp.client.proxy.PlaceRequest;

public class ChangePlaceEvent extends GwtEvent<ChangePlaceHandler> {
	private static final Type<ChangePlaceHandler> TYPE = new Type<ChangePlaceHandler>();
	private final PlaceRequest placeRequest;

	private ChangePlaceEvent(PlaceRequest placeRequest) {
		this.placeRequest = placeRequest;
	}

	public PlaceRequest getPlaceRequest() {
		return placeRequest;
	}

	public static void fire(final HasHandlers source, PlaceRequest placeRequest) {
		source.fireEvent(new ChangePlaceEvent(placeRequest));
	}

	public static Type<ChangePlaceHandler> getType() {
		return TYPE;
	}
	@Override
	public Type<ChangePlaceHandler> getAssociatedType() {
		return getType();
	}

	@Override
	protected void dispatch(ChangePlaceHandler handler) {
		handler.onChangePlace(this);
	}
}
